package com.zallds.utils;

import org.apache.flink.api.common.functions.FlatMapFunction;
import org.apache.flink.api.java.tuple.Tuple2;
import org.apache.flink.util.Collector;

/**
 * Created by liujian on 2021/5/10.
 */
public class Utils {

    public static class Splitter implements FlatMapFunction<String, Tuple2<String, Integer>> {
        @Override
        public void flatMap(String s, Collector<Tuple2<String, Integer>> collector) throws Exception {
            String name = s.split(" ")[0];
            Integer age = Integer.parseInt(s.split(" ")[1]);
            collector.collect(new Tuple2<String, Integer>(name, age));
        }
    }
}
